using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using TimeTableManagement.Entities;

namespace TimeTableManagement.Mapping
{
	public class Tb_Slot_RoomMap : EntityTypeConfiguration<Tb_Slot_Room>
	{
		public Tb_Slot_RoomMap()
		{
			// Primary Key
			this.HasKey(t => t.id);

			// Properties
			this.Property(t => t.action)
				.HasMaxLength(50);
				
			// Table & Column Mappings
			this.ToTable("Tb_Slot_Room");
			this.Property(t => t.id).HasColumnName("id");
			this.Property(t => t.id_room).HasColumnName("id_room");
			this.Property(t => t.id_slot).HasColumnName("id_slot");
			this.Property(t => t.action).HasColumnName("action");
			this.Property(t => t.description).HasColumnName("description");
			this.Property(t => t.date).HasColumnName("date");
			this.Property(t => t.status).HasColumnName("status");

			// Relationships
			this.HasOptional(t => t.Tb_Room)
				.WithMany(t => t.Tb_Slot_Room)
				.HasForeignKey(d => d.id_room);
				
			this.HasOptional(t => t.Tb_Slot)
				.WithMany(t => t.Tb_Slot_Room)
				.HasForeignKey(d => d.id_slot);
				
		}
	}
}

